/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 07 - 09
 * Time: 10:36
 */
class Solution1 {
    public ListNode removeDuplicateNodes(ListNode head) {
        ListNode ob = head;
        while(ob != null) {
            ListNode oc = ob;
            while(oc.next != null) {//取出链表的第一个值ob.val，用oc先遍历完链表去掉与ob.val相同的值,然后ob=ob.next、oc=ob
                if(oc.next.val == ob.val) {
                    oc.next = oc.next.next;
                }else {
                    oc = oc.next;
                }
            }
            ob = ob.next;
        }
        return head;
    }
}